from .base import BaseConfig
from utils import common


class ServiceConfig(BaseConfig):
    def __init__(self, path):
        super().__init__(path)

    def is_debug(self):
        debug = common.get_data_value(self.__config, "debug")
        return debug == 1

    def get_startup_services(self):
        services = common.get_data_value(self.__config, "startup")
        if not services:
            services = []
        return services

    def get_enabled_startup_services(self):
        services = self.get_startup_services()
        enabledList = []
        for service in services:
            if "enable" in service:
                if service["enable"] == 1:
                    enabledList.append(service)
        return enabledList
